<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="vueinside">
        <p :style="{fontSize:fontSize+'px'}">父组件内容</p>
        <!-- 子组件向父亲传值 自定义事件 $event是固定的写法-->
        <zi @zifn='fufn($event)'></zi>
    </div>
</body>
<script src="./js/vue.js"></script>
<script>
    // 子组件
    Vue.component('zi', {
        template: `
        <div>
            <button @click="$emit('zifn',10)">加大字体</button>
         </div>
`,
    })
    var vueShili = new Vue(
        {
            el: '#vueinside',
            data() {
                return {
                    fontSize: 12,
                }
            },
            methods: {
                fufn: function ($event) {
                    this.fontSize += $event;
                }
            },
        }
    )
</script>

</html>